home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / rexx / 462 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.6 KB

  1. Path: STERLING.COM!Ross_Patterson
  2. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  3. Newsgroups: comp.lang.rexx
  4. Message-ID: <199601231455.JAA14589@mail.Reston.VMD.Sterling.COM>
  5. Date: Tue, 23 Jan 1996 10:25:13 EST
  6. Sender: REXX Programming discussion list <REXXLIST@uga.cc.uga.edu>
  7. From: Ross Patterson <Ross_Patterson@STERLING.COM>
  8. Subject: Re: This just HAS to be simple!
  9.  
  10. Frank Merrow <fmerrow@WIZARD.QUALCOMM.COM> writes:
  11.  
  12. >Except I cannot for the life of me figure out what to put at ???.  sigl
  13. >isn't active (no value), sourceline() does the wrong thing.  I even looked
  14. >at PARSE SOURCE, but this was no help.  How do you get the current line
  15. >number?
  16.  
  17. You can't.  The only line-number reference in REXX is the contents of
  18. the special variable SIGL, which is set to the line-number from which
  19. control was diverted.
  20.  
  21. >         Even if I did involk a signal JUST to get the line number is
  22. >destroy's DO and such, put how do I get BACK?
  23.  
  24. Try the CALL instruction.  SIGL is set by SIGNAL, CALL and
  25. function-calls, so the following code does what you want:
  26.  
  27.    ...
  28.    Call ErrorMessage 'Top of the world, Ma!'
  29.    ...
  30.    ErrorMessage: Say 'Error at line' SigL ||':' Arg(1)
  31.    Return
  32.  
  33. If you need a general-purpose line-number function, consider:
  34.  
  35.    Line = LineNumber()
  36.    ...
  37.    LineNumber: Return SigL
  38.  
  39. The only caveat is that if the called routine begins with a PROCEDURE
  40. instruction, you must include SIGL in the EXPOSE list.  SIGL is set
  41. in the context of the caller, so it exists before the called routine
  42. gets control, and will therefore be hidden by a PROCEDURE unless
  43. explicitly exposed.
  44.  
  45. Ross Patterson
  46. Sterling Software, Inc.
  47. VM Software Division
  48.